<form id="add-form" class="form-horizontal" role="form" data-toggle="validator" method="POST" action="">

    <div class="form-group">
        <label class="control-label col-xs-12 col-sm-2">房间标题:</label>
        <div class="col-xs-12 col-sm-8">
            <input id="c-h_title" data-rule="required" class="form-control" name="row[h_title]" type="text" value="{$row.h_title|htmlentities}">
        </div>
    </div>
    <div class="form-group">
        <label class="control-label col-xs-12 col-sm-2">注1:</label>
        <div class="col-xs-12 col-sm-8">
            <input id="c-tip1" data-rule="required" class="form-control" name="row[tip1]"   type="text" value="{$row.tip1|htmlentities}">
        </div>
    </div>
    <div class="form-group">
        <label class="control-label col-xs-12 col-sm-2">注2:</label>
        <div class="col-xs-12 col-sm-8">
            <input id="c-tip2" data-rule="required" class="form-control" name="row[tip2]"  type="text" value="{$row.tip2|htmlentities}">
        </div>
    </div>
    <div class="form-group">
        <label class="control-label col-xs-12 col-sm-2">房间编号:</label>
        <div class="col-xs-12 col-sm-8">
            <input id="h_housebrand" data-rule="required" class="form-control" name="row[h_housebrand]" type="text" value="{$row.h_housebrand|htmlentities}">
        </div>
    </div>

    <div class="form-group">
        <label class="control-label col-xs-12 col-sm-2">房间状态:</label>
        <div class="col-xs-12 col-sm-8">
            <input type="hidden" id="h_statusText" value="{$row.h_statusText}" />
            <select id="c-room" data-rule="required" class="form-control" name="row[h_statusText]">
                <option value="normal">正常</option>
                <option value="using">使用中</option>
                <option value="repair">维修</option>
                <option value="cleaning">打扫</option>
                <option value="reserve">预定</option>
                <option value="hidden">隐藏</option>
            </select>
        </div>
    </div>


    <div class="form-group">
        <label for="c-thumb" class="control-label col-xs-12 col-sm-2">房间图片:</label>
        <div class="col-xs-12 col-sm-8">
            <div class="input-group">
                <input id="c-thumb" class="form-control" size="35" name="row[h_imgs]" type="text" value="{$row.h_imgs}">
                <div class="input-group-addon no-border no-padding">
                    <span><button type="button" id="plupload-image" class="btn btn-danger plupload" data-input-id="c-thumb" data-mimetype="image/gif,image/jpeg,image/png,image/jpg,image/bmp" data-multiple="true" data-preview-id="p-image"><i class="fa fa-upload"></i> {:__('Upload')}</button></span>
                    <span><button type="button" id="fachoose-image" class="btn btn-primary fachoose" data-input-id="c-thumb" data-mimetype="image/*" data-multiple="true"><i class="fa fa-list"></i> {:__('Choose')}</button></span>
                </div>
                <span class="msg-box n-right" for="c-thumb"></span>
            </div>
            <ul class="row list-inline plupload-preview" id="p-image"></ul>
        </div>
    </div>


    <div class="form-group">
        <label class="control-label col-xs-12 col-sm-2">选择酒店:</label>
        <div class="col-xs-12 col-sm-8">

            <select id="c-type" data-rule="required" class="form-control" name="row[h_id]" onchange="show_sub(this.options[this.options.selectedIndex].value)">
                {foreach name="hotelList" item="vo"}
                    <option {if $row.h_id == $vo.hid} selected {/if} value="{$vo.hid}">{$vo.hoteltitle}</option>

                {/foreach}
            </select>
        </div>
    </div>

    <!--<div class="form-group">-->
        <!--<label class="control-label col-xs-12 col-sm-2">选择楼层[单元]:</label>-->
        <!--<div class="col-xs-12 col-sm-8">-->

            <!--<select id="c-h_storey" data-rule="required" class="form-control" name="row[h_storey]">-->
                <!--{foreach name="hotelNumArr" item="vo"}-->
                    <!--<option {if $row.h_storey == $vo} selected {/if} value="{$vo}">{$vo}</option>-->
                <!--{/foreach}-->
            <!--</select>-->
        <!--</div>-->
    <!--</div>-->

    <div class="form-group">
        <label class="control-label col-xs-12 col-sm-2">销量:</label>
        <div class="col-xs-12 col-sm-8">
            <input id="c-h_sell" class="form-control"   name="row[h_sell]" type="number" value="{$row.h_sell|htmlentities}">
        </div>
    </div>
   <!-- <div class="form-group">
        <label class="control-label col-xs-12 col-sm-2">库存:</label>
        <div class="col-xs-12 col-sm-8">
            <input id="c-h_stock" class="form-control"   name="row[h_stock]" type="number" value="{$row.h_stock|htmlentities}">
        </div>
    </div>-->


    <div class="form-group">
        <label class="control-label col-xs-12 col-sm-2">单价[时]:</label>
        <div class="col-xs-12 col-sm-8">
            <input id="c-h_price" data-rule="required" class="form-control"  name="row[h_price]" type="number"  value="{$row.h_price|htmlentities}">
        </div>
    </div>
    <div class="form-group">
        <label class="control-label col-xs-12 col-sm-2">周末单价[时]:</label>
        <div class="col-xs-12 col-sm-8">
            <input id="c-h_weekprice" data-rule="required" class="form-control"  name="row[h_weekprice]" type="number"  value="{$row.h_weekprice|htmlentities}">
        </div>
    </div>

    <div class="form-group">
        <label class="control-label col-xs-12 col-sm-2">价格日历:</label>
        <div class="col-xs-12 col-sm-8">
            <a  href='{:url("/calendar?id=$ids")}' class="btn btn-success btn-dialog">价格日历</a>
        </div>
    </div>



    <div class="form-group">
        <label class="control-label col-xs-12 col-sm-2">倍数:</label>
        <div class="col-xs-12 col-sm-8">
            <input id="c-h_times" data-rule="required" class="form-control" step="1" name="row[h_times]" type="number" value="{$row.h_times|htmlentities}">
        </div>
    </div>


    <div class="form-group">
        <label class="control-label col-xs-12 col-sm-2">允许付款方式:</label>
        <div class="col-xs-12 col-sm-8">
            <input type="hidden" id="h_paysytle" value="{$row['h_paysytle']}">
            <div class="col-xs-12 col-sm-8"  id="h_paysytleval">
                <label class="checkbox-inline checkbox" style="line-height: 24px;">
                    <input type="checkbox"  name="h_paysytle[]"  value="0"> 微信
                </label>
                <label class="checkbox-inline checkbox" style="line-height: 24px;">
                    <input type="checkbox"  name="h_paysytle[]"  value="1"> 余额
                </label>
                <label class="checkbox-inline checkbox" style="line-height: 24px;">
                    <input type="checkbox"  name="h_paysytle[]"  value="2"> 小时卡
                </label>
            </div>
        </div>
    </div>

    <div class="form-group">
        <label class="control-label col-xs-12 col-sm-2">标签:</label>
        <div class="col-xs-12 col-sm-8">
            <input type="hidden" id="h_lebals" value="{$row['h_lebals']}">
            <div class="col-xs-12 col-sm-8" id="h_lebalsval">
                {foreach $labels as $key=>$vo}
                <label class="checkbox-inline checkbox" style="line-height: 24px;">
                    <input type="checkbox"   name="h_lebals[]" value="{$vo.id}"> {$vo.ltitle}
                </label>
                {/foreach}
            </div>
        </div>
    </div>

    <div class="form-group">
        <label class="control-label col-xs-12 col-sm-2">房型:</label>
        <div class="col-xs-12 col-sm-8">
            <input type="hidden" id="h_types" value="{$row['h_types']}">
            <div class="col-xs-12 col-sm-8" id="h_typesval">
                {foreach $types as $key=>$vo}
                <label class="checkbox-inline checkbox" style="line-height: 24px;">
                    <input type="checkbox"   name="h_types[]" value="{$vo.id}"> {$vo.ttitle}
                </label>
                {/foreach}
            </div>
        </div>
    </div>

    <div class="form-group">
        <label class="control-label col-xs-12 col-sm-2">服务:</label>
        <div class="col-xs-12 col-sm-8">
            <input type="hidden" id="h_servs" value="{$row['h_servs']}">
            <div class="col-xs-12 col-sm-8" id="h_servsval">
                {foreach $fw as $key=>$vo}
                <label class="checkbox-inline checkbox" style="line-height: 24px;">
                    <input type="checkbox"   name="h_servs[]" value="{$vo.id}"> {$vo.name}
                </label>
                {/foreach}
            </div>
        </div>
    </div>

    <div class="form-group">
        <label class="control-label col-xs-12 col-sm-2">基础:</label>
        <div class="col-xs-12 col-sm-8">
            <input type="hidden" id="h_service" value="{$row['h_service']}">
            <div class="col-xs-12 col-sm-8"  id="h_serviceval">

                {foreach $jc as $key=>$vo}
                <label class="checkbox-inline checkbox" style="line-height: 24px;">
                    <input type="checkbox"   name="h_service[]" value="{$vo.id}"> {$vo.name}
                </label>
                {/foreach}

            </div>
        </div>
    </div>

    <div class="form-group">
        <label class="control-label col-xs-12 col-sm-2">卫浴:</label>
        <div class="col-xs-12 col-sm-8">
            <input type="hidden" id="h_service2" value="{$row['h_service2']}">
            <div class="col-xs-12 col-sm-8" id="h_service2val">

                {foreach $wy as $key=>$vo}
                <label class="checkbox-inline checkbox" style="line-height: 24px;">
                    <input type="checkbox"   name="h_service2[]" value="{$vo.id}"> {$vo.name}
                </label>
                {/foreach}



            </div>
        </div>
    </div>

    <div class="form-group">
        <label class="control-label col-xs-12 col-sm-2">入住须知:</label>
        <div class="col-xs-12 col-sm-8">
                <input type="hidden" id="hreads" value="{$row['h_read']}">
            <div class="col-xs-12 col-sm-8" id="hreadsval">

                {foreach $rzxz as $key=>$vo}
                <label class="checkbox-inline checkbox" style="line-height: 24px;">
                    <input type="checkbox"   name="h_read[]" value="{$vo.id}"> {$vo.name}
                </label>
                {/foreach}


            </div>
        </div>
    </div>

    <hr>

    <div class="form-group">
        <label class="control-label col-xs-12 col-sm-2">面积:</label>
        <div class="col-xs-12 col-sm-8">
            <input id="c-h_mi" data-rule="required" class="form-control"  name="row[h_mi]" type="text"  value="{$row.h_mi|htmlentities}">
        </div>
    </div>
    <div class="form-group">
        <label class="control-label col-xs-12 col-sm-2">可住:</label>
        <div class="col-xs-12 col-sm-8">
            <input id="c-h_people" data-rule="required" class="form-control"  name="row[h_people]" type="text"  value="{$row.h_people|htmlentities}">
        </div>
    </div>
    <div class="form-group">
        <label class="control-label col-xs-12 col-sm-2">宽带:</label>
        <div class="col-xs-12 col-sm-8">
            <input id="c-h_wifi" data-rule="required" class="form-control"  name="row[h_wifi]" type="text" value="{$row.h_wifi|htmlentities}">
        </div>
    </div>
    <div class="form-group">
        <label class="control-label col-xs-12 col-sm-2">窗户:</label>
        <div class="col-xs-12 col-sm-8">
            <input id="c-h_win" data-rule="required" class="form-control"  name="row[h_win]" type="text" value="{$row.h_win|htmlentities}">
        </div>
    </div>
    <div class="form-group">
        <label class="control-label col-xs-12 col-sm-2">床型:</label>
        <div class="col-xs-12 col-sm-8">
            <input id="c-h_bed" data-rule="required" class="form-control"  name="row[h_bed]" type="text" value="{$row.h_bed|htmlentities}">
        </div>
    </div>
    <div class="form-group">
        <label class="control-label col-xs-12 col-sm-2">吸烟政策:</label>
        <div class="col-xs-12 col-sm-8">
            <input id="c-h_smoke" data-rule="required" class="form-control"  name="row[h_smoke]" type="text" value="{$row.h_smoke|htmlentities}">
        </div>
    </div>
    <div class="form-group">
        <label class="control-label col-xs-12 col-sm-2">餐食:</label>
        <div class="col-xs-12 col-sm-8">
            <input id="c-h_food" data-rule="required" class="form-control"  name="row[h_food]" type="text" value="{$row.h_food|htmlentities}">
        </div>
    </div>

    <hr>



    <div class="form-group">
        <label for="c-editor" class="control-label col-xs-12 col-sm-2">房间详情:</label>

        <div class="col-xs-12 col-sm-8">
            <textarea name="row[h_content]" id="c-editor" cols="60" rows="5" class="form-control">{$row.h_content|htmlentities}</textarea>
        </div>

    </div>
    <!--<div class="form-group">-->
        <!--<label for="c-editor" class="control-label col-xs-12 col-sm-2">扣款说明:</label>-->

        <!--<div class="col-xs-12 col-sm-8">-->
            <!--<textarea name="row[h_paymentroom]" id="c-editor" cols="60" rows="5" class="form-control">{$row.h_paymentroom|htmlentities}</textarea>-->
        <!--</div>-->

    <!--</div>-->
    <!--<div class="form-group">-->
        <!--<label for="c-editor" class="control-label col-xs-12 col-sm-2">服务提供方:</label>-->

        <!--<div class="col-xs-12 col-sm-8">-->
            <!--<textarea name="row[h_serviceroom]" id="c-editor" cols="60" rows="5" class="form-control">{$row.h_serviceroom|htmlentities}</textarea>-->
        <!--</div>-->

    <!--</div>-->

    <input type="hidden" id="admin" value="{$adminId}" />
    <div class="form-group" id="auditing" style="display: none">
        <label class="control-label col-xs-12 col-sm-2">{:__('auditing')}:</label>
        <div class="col-xs-12 col-sm-8">
            {:build_radios('row[auditing]', ['0'=>__('auditing0'), '1'=>__('auditing1'),'2'=>__('auditing2')], $row['auditing'])}
        </div>
    </div>

    <div class="form-group">
        <label class="control-label col-xs-12 col-sm-2">{:__('Status')}:</label>
        <div class="col-xs-12 col-sm-8">
            {:build_radios('row[h_status]', ['normal'=>__('Normal'), 'hidden'=>__('Hidden')], $row['h_status'])}
        </div>
    </div>

    <div class="form-group layer-footer">
        <label class="control-label col-xs-12 col-sm-2"></label>
        <div class="col-xs-12 col-sm-8">
            <button type="submit" class="btn btn-success btn-embossed">{:__('OK')}</button>
            <button type="reset" class="btn btn-default btn-embossed">{:__('Reset')}</button>
        </div>
    </div>
</form>

<script>
    //下拉框切换
    function show_sub(v){
        $.ajax({
            type: "POST",
            url: "house/AjaxHotelNum",
            data: {hotelid:v},
            dataType: "json",
            success: function(data){
                if(data["msg"] == "error"){
                    $('#c-h_storey').empty();   //清空resText里面的所有内容
                    layer.alert("酒店楼层数据有误,请检查酒店参数");
                    return
                }else{
                    $('#c-h_storey').empty();   //清空resText里面的所有内容
                    var html = '';
                    $.each(data.data, function(commentIndex, comment){
                        html += '<option value="'+ comment +'">'+ comment +'</option>';
                    });
                    $('#c-h_storey').html(html);
                }

            }
        });
    }







</script>
